import { createWebHashHistory , createRouter } from 'vue-router'
import Layout from "@/layout/index.vue"
import NotFound from '@/page/404.vue'

import feedback from './module/feedback';
import order from './module/order'
import product from './module/product';
import role from './module/role';
import system from './module/system';
import account from "./module/account"

import test from './module/test'


const routes = [
  { 
    path: '', 
    component: Layout,
    name:'Layout',
    redirect: '/index',
    children: [
      { 
        path: '/index', 
        name: '首页',
        meta: { title: '首页'},
        component: () => import('@/views/index/index.vue') 
      },
      { 
        path: '/banner', 
        name: 'Banner图',
        meta: { title: 'Banner图'},
        component: () => import('@/views/banner/index.vue') 
      },
      { 
        path: '/helpcenter', 
        name: '帮助中心',
        meta: { title: '帮助中心'},
        component: () => import('@/views/helpcenter/index.vue') 
      },
      // ...feedback,
      ...order,
      ...product,
      // ...role,
      // ...system,
      ...account,
      ...test
    ],
    
  },
  { 
    path: '/login', 
    meta: { title: '登录',skip:true },
    component:  () => import('@/views/login/index.vue') 
  },
  { path: '/:pathMatch(.*)*',meta:{title:"404",skip:true}, name: 'NotFound', component: NotFound },

]

const router = createRouter({
  history: createWebHashHistory (),
  routes,
})

export default router;